class functionTools {
  static getUrlParam (paramName) {
    let [paramValue, isFound] = ['', !1];
    if (window.location.hash.split('?').length < 2) {
      return null;
    }
    let paramUrl = window.location.hash.split('?')[1];
    if (paramUrl.indexOf('=') > 1) {
      const arrSource = paramUrl.split('&');
      let i = 0;
      while (i < arrSource.length && !isFound) {
        const item = arrSource[i];
        if (item.indexOf('=') > 0 && item.split('=')[0].toLowerCase() === paramName.toLowerCase()) {
          paramValue = item.split('=')[1];
          isFound = !0;
        }
        i++;
      }
    }
    paramValue === '' && (paramValue = null);
    return paramValue;
  }
  static formatTimeStr (date) {
    const y = date.getFullYear();
    let m = date.getMonth() + 1;
    m = m < 10 ? ('0' + m) : m;
    var d = date.getDate();
    d = d < 10 ? ('0' + d) : d;
    let h = date.getHours();
    h = h < 10 ? ('0' + h) : h;
    let minute = date.getMinutes();
    minute = minute < 10 ? ('0' + minute) : minute;
    let second = date.getSeconds();
    second = second < 10 ? ('0' + second) : second;
    return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;
  };
}

export default functionTools;
